irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
lines(x,irf,col="grey")
b<-(-.143)
c<-(-.189)
d<-(0.886)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
lines(x,irf,col="black",lty="dashed")
legend(8,-.4,legend=c("3","1","2"),
col=c("black", "grey","black"), lty=c(1,1,2))
# Slika 1.220.
b<-(-.402)
c<-(-.168)
d<-(1.008)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
x<-0:10
plot(x,irf,ylab="IRF",xlim=c(0,10),type="l")
abline(h=0,lty="dashed")
b<-(-.052)
c<-(-.083)
d<-(0.953)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
lines(x,irf,col="grey")
b<-(-.143)
c<-(-.189)
d<-(0.886)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
lines(x,irf,col="black",lty="dashed")
legend(8,-.4,legend=c("1","2","3"),
col=c( "grey","black","black"), lty=c(1,2,1))
# Slika 1.220.
b<-(-.402)
c<-(-.168)
d<-(1.008)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
x<-0:10
plot(x,irf,ylab="IRF",xlim=c(0,10),type="l")
abline(h=0,lty="dashed")
b<-(-.052)
c<-(-.083)
d<-(0.953)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
lines(x,irf,col="grey")
b<-(-.143)
c<-(-.189)
d<-(0.886)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
lines(x,irf,col="black",lty="dashed")
legend(8,-.4,legend=c("1","2","3"),
col=c( "grey","black","black"), lty=c(1,2,1))
# Slika 1.220.
b<-(-.402)
c<-(-.168)
d<-(1.008)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
x<-0:10
plot(x,irf,ylab="IRF",xlim=c(0,10),type="l")
abline(h=0,lty="dashed")
b<-(-.052)
c<-(-.083)
d<-(0.953)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
lines(x,irf,col="grey")
b<-(-.143)
c<-(-.189)
d<-(0.886)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
lines(x,irf,col="black",lty="dashed")
legend(8,-.4,legend=c("1","2","3"),
col=c( "grey","black","black"), lty=c(1,2,1))
# Slika 1.220.
b<-(-.402)
c<-(-.168)
d<-(1.008)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
x<-0:10
plot(x,irf,ylab="IRF",xlim=c(0,10),type="l")
abline(h=0,lty="dashed")
b<-(-.052)
c<-(-.083)
d<-(0.953)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
lines(x,irf,col="grey")
b<-(-.143)
c<-(-.189)
d<-(0.886)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
lines(x,irf,col="black",lty="dashed")
legend(8,-.4,legend=c("1","2","3"),
col=c( "grey","black","black"), lty=c(1,2,1))
# Slika 1.220.
b<-(-.402)
c<-(-.168)
d<-(1.008)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
x<-0:10
plot(x,irf,ylab="IRF",xlim=c(0,10),type="l")
abline(h=0,lty="dashed")
b<-(-.052)
c<-(-.083)
d<-(0.953)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
lines(x,irf,col="grey")
b<-(-.143)
c<-(-.189)
d<-(0.886)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
lines(x,irf,col="black",lty="dashed")
legend(8,-.4,legend=c("1","2","3"),
col=c( "grey","black","black"), lty=c(1,2,1))
# Slika 1.220.
b<-(-.402)
c<-(-.168)
d<-(1.008)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
x<-0:10
plot(x,irf,ylab="IRF",xlim=c(0,10),type="l")
abline(h=0,lty="dashed")
b<-(-.052)
c<-(-.083)
d<-(0.953)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
lines(x,irf,col="grey")
b<-(-.143)
c<-(-.189)
d<-(0.886)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
lines(x,irf,col="black",lty="dashed")
legend(8,-.3,legend=c("1","2","3"),
col=c( "grey","black","black"), lty=c(1,2,1))
grangertest(s.iip,s.nez,2)
grangertest(s.iip,s.nez,1)
lm(nez~iip)
grangertest(s.nez,s.iip,3)
iip<-iip/decompose(iip,type="multiplicative")$seasonal
nez<-nez/decompose(nez,type="multiplicative")$seasonal
lm(nez~iip)
rez<-resid(lm(nez~iip))
rez<-ts(rez,start=c(2001,1),frequency = 12)
library(dynlm)
dynlm(diff(nez)~diff(iip)+L(rez))
dinamicki<-read.table("rh_dinamicki.txt",sep="\t",header=T)
iip<-ts(dinamicki$hr_iip,start=c(2000,1),frequency = 12)
nez<-ts(dinamicki$hr_nez,start=c(2000,1),frequency = 12)
s.iip<-diff(log(iip/decompose(iip,type="multiplicative")$seasonal),12)
s.nez<-diff(log(nez/decompose(nez,type="multiplicative")$seasonal),12)
# Slika 1.212.
library(dynlm)
dynlm(s.nez~L(s.nez)+s.iip+L(s.iip))
#Slika 1.213.
b<-(-0.1141)
c<-(-.068)
d<-(0.9552)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
x<-0:10
plot(x,irf,ylab="IRF",xlim=c(0,10),type="l")
abline(h=0,lty="dashed")
#Slika 1.214.
irf<-cumsum(irf)
plot(x,irf,ylab="kumulativno_IRF",xlim=c(0,10),type="l")
# Slika 1.215
library(dynlm)
dynlm(s.nez~L(s.nez)+s.iip)
#Slika 1.216.
par(mfrow = c(1,2),oma=c(1,0,0,1),mar=c(1,4,1,1))
b<-(-0.145)
c<-(0)
d<-(0.963)
irf<-c(0,b,d*b+c,d*(d*b+c),d^2*(d*b+c),d^3*(d*b+c),d^4*(d*b+c),
d^5*(d*b+c),d^6*(d*b+c),d^7*(d*b+c),d^8*(d*b+c))
x<-0:10
plot(x,irf,ylab="IRF",xlim=c(0,10),type="l")
abline(h=0,lty="dashed")
irf<-cumsum(irf)
plot(x,irf,ylab="kumulativno_IRF",xlim=c(0,10),type="l")
# Slika 1.217.
library(dynlm)
dynlm(s.nez~s.iip+L(s.iip))
#Slika 1.218.
library(readxl)
# Instalirati sljedece pakete prije provodenja naredbi (ako prvi puta radite u R-u):
paketi<-c("car","dummies","dynlm","lmtest","lmSupport","Matrix","matrixStats",
"Deriv","moments","normtest","quantmod","QuantPsyc","tseries","urca","vars",
"xlsx","stats","stats4","forecast","readxl","gap","strucchange","sandwich","car",
"vars","tsutils","sandwich")
install.packages(paketi,dependencies = T)
library("remotes")
install.packages(paketi, dependencies = T)
install.packages(paketi, dependencies = T)
install.packages(paketi, dependencies = T)
install.packages(paketi, dependencies = T)
install.packages(paketi, dependencies = T)
install.packages(paketi, dependencies = T)
install.packages(paketi, dependencies = T)
install.packages(paketi, dependencies = T)
install.packages(paketi, dependencies = T)
install.packages(paketi, dependencies = T)
install.packages(paketi, dependencies = T)
install.packages(paketi, dependencies = T)
install.packages(paketi, dependencies = T)
source("C:/Users/njerak/Desktop/Tihana 2/datoteke VN prosinac 2022/R skripta VN.R")
paketi<-c("car","dummies","dynlm","devEMF","lmtest","lmSupport","Matrix","matrixStats",
"Deriv","moments","normtest","quantmod","QuantPsyc","tseries","urca","vars",
"xlsx","stats","stats4","forecast","readxl","gap","strucchange","sandwich")
install.packages(paketi,dependencies = T)
install.packages(paketi, dependencies = T)
install.packages(paketi, dependencies = T)
install.packages(paketi, dependencies = T)
install.packages(paketi, dependencies = T)
paketi<-c("car","dummies","dynlm","lmtest","lmSupport","Matrix","matrixStats",
"Deriv","moments","normtest","quantmod","QuantPsyc","tseries","urca","vars",
"xlsx","stats","stats4","forecast","readxl","gap","strucchange","sandwich","car",
"vars","tsutils","sandwich")
install.packages(paketi,dependencies = T)
install.packages(paketi, dependencies = T)
library(readxl)
library(forecast)
iip<-read.table("iip.txt",header=T,sep="\t")
IIP<-ts(iip$IIP,start=c(1998,1),frequency=12)
bdp<-read.table("bdp.txt",header=T,sep="\t")
BDP<-ts(bdp$BDP,start=c(1995,1),frequency = 4)
BDP<-BDP/decompose(BDP,type="multiplicative")$season
tecaj <- read_excel("tecaj.xlsx",sheet="List1")
tecaj<-ts(tecaj$teÄŤaj,start=c(2000,1),frequency = 12)
library(readxl)
library(forecast)
iip<-read.table("iip.txt",header=T,sep="\t")
IIP<-ts(iip$IIP,start=c(1998,1),frequency=12)
bdp<-read.table("bdp.txt",header=T,sep="\t")
BDP<-ts(bdp$BDP,start=c(1995,1),frequency = 4)
BDP<-BDP/decompose(BDP,type="multiplicative")$season
tecaj <- read_excel("tecaj.xlsx",sheet="List1")
tecaj<-ts(tecaj$tecaj,start=c(2000,1),frequency = 12)
dolasci<-read_excel("msi-turizam.xlsx",sheet="List1")
dolasci<-ts(dolasci$`dolasci, ukupno u 000`,start=c(2010,1),frequency = 12)
des_dolasci<-ma(dolasci,12,centre=T)
par(mfrow = c(2,2),oma=c(1,1,1,1),mar=c(2,2,2,2))
plot(IIP,xlab=NA,ylab=NA)
plot(BDP,xlab=NA,ylab=NA)
plot(tecaj,xlab=NA,ylab=NA)
plot(dolasci,xlab=NA,ylab=NA)
lines(des_dolasci,lty="dashed")
legend("topleft", legend=c("dolasci, ukupno u 000","desezonirano"),
col=c("black", "black"), lty=c(1,2))
#Slika 1.2.
iip<-read.table("iip.txt",header=T,sep="\t")
IIP<-ts(iip$IIP,start=c(1998,1),frequency=12)
plot(decompose(IIP,type="additive"))
bdp<-read.table("bdp.txt",header=T,sep="\t")
BDP<-ts(bdp$BDP,start=c(1995,1),frequency = 4)
stopa_a<-diff(log(BDP))
stopa_b<-diff(log(BDP),4)
par(mfrow = c(1,2),oma=c(1,1,1,1),mar=c(2,2,2,2))
plot(stopa_a)
plot(stopa_b)
View(bdp)
iip<-read.table("iip.txt",header=T,sep="\t")
IIP<-ts(iip$IIP,start=c(1998,1),frequency=12)
library(forecast)
binarne<-seasonaldummy(IIP)
View(binarne)
knitr::opts_chunk$set(echo = TRUE)
iip<-read.table("iip.txt",header=T,sep="\t")
IIP<-ts(iip$IIP,start=c(1998,1),frequency=12)
library(forecast)
binarne<-seasonaldummy(IIP)
#Slika 1.81
library("FitARMA")
install_github("cran/FitAR")
library
library("remotes")
install_github("cran/FitAR")
install_github("cran/FitARMA")
write.csv(epsilon,"epsilon.csv")
getwd()
knitr::opts_chunk$set(echo = TRUE)
```{r Slika 1.14. i 1.15., warning=FALSE}
#### Slika 1.13.
```{r Slika 1.13., warning=FALSE}
View(bdp)
View(bdp)
#### Slika 1.13.
```{r Slika 1.13., warning=FALSE}
#### Slika 1.13.
```{r Slika 1.13., warning=FALSE}
knitr::opts_chunk$set(echo = TRUE)
lines(ts(fitted(m1),start=c(1995,1),frequency = 4),lty="dashed")
bdp<-read.table("bdp.txt",header=T,sep="\t")
bdp<-ts(bdp$BDP,start=c(1995,1),frequency = 4)
par(mfrow = c(1,1),oma=c(1,0,0,1),mar=c(1,4,1,1))
plot(bdp,xlab="godine",ylab="BDP")
```
bdp<-read.table("bdp.txt",header=T,sep="\t")
bdp<-ts(bdp$BDP,start=c(1995,1),frequency = 4)
#SLika 1.13.
par(mfrow = c(1,1),oma=c(1,0,0,1),mar=c(1,4,1,1))
plot(bdp,xlab="godine",ylab="BDP")
#Slika 1.14 i 1.15.
library(forecast)
bin<-seasonaldummy(bdp)
bin2<-c(rep(1,52),rep(0,102-52))
trend<-ts(1:102,start=c(1995,1),frequency = 4)
m1<-lm(bdp~bin)
m2<-lm(bdp~bin+I(bin*bin2))
m3<-lm(bdp~bin+trend+I(bin*bin2)+I(trend*bin2))
library(stargazer)
stargazer(list(m1,m2,m3),type="text")
#Slika 1.16
lines(ts(fitted(m1),start=c(1995,1),frequency = 4),lty="dashed")
lines(ts(fitted(m2),start=c(1995,1),frequency = 4),col="grey")
lines(ts(fitted(m3),start=c(1995,1),frequency = 4),col="black",type="b",lty=1)
legend("topleft", legend=c("BDP", "m1","m2","m3"),
col=c("black", "black","grey","black"), lty=c(1,2,1,3))
library(forecast)
bin<-seasonaldummy(bdp)
bin2<-c(rep(1,52),rep(0,102-52))
trend<-ts(1:102,start=c(1995,1),frequency = 4)
m1<-lm(bdp~bin)
m2<-lm(bdp~bin+I(bin*bin2))
m3<-lm(bdp~bin+trend+I(bin*bin2)+I(trend*bin2))
library(stargazer)
stargazer(list(m1,m2,m3),type="text")
```
library(forecast)
bdp<-ts(bdp$BDP,start=c(1995,1),frequency = 4)
library(readxl)
library(forecast)
iip<-read.table("iip.txt",header=T,sep="\t")
IIP<-ts(iip$IIP,start=c(1998,1),frequency=12)
bdp<-read.table("bdp.txt",header=T,sep="\t")
BDP<-ts(bdp$BDP,start=c(1995,1),frequency = 4)
BDP<-BDP/decompose(BDP,type="multiplicative")$season
tecaj <- read_excel("tecaj.xlsx",sheet="List1")
tecaj<-ts(tecaj$tecaj,start=c(2000,1),frequency = 12)
dolasci<-read_excel("msi-turizam.xlsx",sheet="List1")
dolasci<-ts(dolasci$`dolasci, ukupno u 000`,start=c(2010,1),frequency = 12)
des_dolasci<-ma(dolasci,12,centre=T)
par(mfrow = c(2,2),oma=c(1,1,1,1),mar=c(2,2,2,2))
plot(IIP,xlab=NA,ylab=NA)
plot(BDP,xlab=NA,ylab=NA)
plot(tecaj,xlab=NA,ylab=NA)
plot(dolasci,xlab=NA,ylab=NA)
lines(des_dolasci,lty="dashed")
legend("topleft", legend=c("dolasci, ukupno u 000","desezonirano"),
col=c("black", "black"), lty=c(1,2))
library(readxl)
library(forecast)
iip<-read.table("iip.txt",header=T,sep="\t")
IIP<-ts(iip$IIP,start=c(1998,1),frequency=12)
bdp<-read.table("bdp.txt",header=T,sep="\t")
BDP<-ts(bdp$BDP,start=c(1995,1),frequency = 4)
BDP<-BDP/decompose(BDP,type="multiplicative")$season
tecaj <- read_excel("tecaj.xlsx",sheet="List1")
tecaj<-ts(tecaj$tecaj,start=c(2000,1),frequency = 12)
dolasci<-read_excel("msi-turizam.xlsx",sheet="List1")
dolasci<-ts(dolasci$`dolasci, ukupno u 000`,start=c(2010,1),frequency = 12)
des_dolasci<-ma(dolasci,12,centre=T)
par(mfrow = c(2,2),oma=c(1,1,1,1),mar=c(2,2,2,2))
plot(IIP,xlab=NA,ylab=NA)
plot(BDP,xlab=NA,ylab=NA)
plot(tecaj,xlab=NA,ylab=NA)
plot(dolasci,xlab=NA,ylab=NA)
lines(des_dolasci,lty="dashed")
legend("topleft", legend=c("dolasci, ukupno u 000","desezonirano"),
col=c("black", "black"), lty=c(1,2))
library(readxl)
library(forecast)
iip<-read.table("iip.txt",header=T,sep="\t")
IIP<-ts(iip$IIP,start=c(1998,1),frequency=12)
bdp<-read.table("bdp.txt",header=T,sep="\t")
BDP<-ts(bdp$BDP,start=c(1995,1),frequency = 4)
BDP<-BDP/decompose(BDP,type="multiplicative")$season
tecaj <- read_excel("tecaj.xlsx",sheet="List1")
tecaj<-ts(tecaj$tecaj,start=c(2000,1),frequency = 12)
dolasci<-read_excel("msi-turizam.xlsx",sheet="List1")
dolasci<-ts(dolasci$`dolasci, ukupno u 000`,start=c(2010,1),frequency = 12)
des_dolasci<-ma(dolasci,12,centre=T)
par(mfrow = c(2,2),oma=c(1,1,1,1),mar=c(2,2,2,2))
plot(IIP,xlab=NA,ylab=NA)
plot(BDP,xlab=NA,ylab=NA)
plot(tecaj,xlab=NA,ylab=NA)
plot(dolasci,xlab=NA,ylab=NA)
lines(des_dolasci,lty="dashed")
legend("topleft", legend=c("dolasci, ukupno u 000","desezonirano"),
col=c("black", "black"), lty=c(1,2))
library(readxl)
library(forecast)
iip<-read.table("iip.txt",header=T,sep="\t")
IIP<-ts(iip$IIP,start=c(1998,1),frequency=12)
bdp<-read.table("bdp.txt",header=T,sep="\t")
BDP<-ts(bdp$BDP,start=c(1995,1),frequency = 4)
BDP<-BDP/decompose(BDP,type="multiplicative")$season
tecaj <- read_excel("tecaj.xlsx",sheet="List1")
tecaj<-ts(tecaj$tecaj,start=c(2000,1),frequency = 12)
dolasci<-read_excel("msi-turizam.xlsx",sheet="List1")
dolasci<-ts(dolasci$`dolasci, ukupno u 000`,start=c(2010,1),frequency = 12)
des_dolasci<-ma(dolasci,12,centre=T)
par(mfrow = c(2,2),oma=c(1,1,1,1),mar=c(2,2,2,2))
plot(IIP,xlab=NA,ylab=NA)
plot(BDP,xlab=NA,ylab=NA)
plot(tecaj,xlab=NA,ylab=NA)
plot(dolasci,xlab=NA,ylab=NA)
lines(des_dolasci,lty="dashed")
legend("topleft", legend=c("dolasci, ukupno u 000","desezonirano"),
col=c("black", "black"), lty=c(1,2))
library(readxl)
library(forecast)
iip<-read.table("iip.txt",header=T,sep="\t")
IIP<-ts(iip$IIP,start=c(1998,1),frequency=12)
bdp<-read.table("bdp.txt",header=T,sep="\t")
BDP<-ts(bdp$BDP,start=c(1995,1),frequency = 4)
BDP<-BDP/decompose(BDP,type="multiplicative")$season
tecaj <- read_excel("tecaj.xlsx",sheet="List1")
tecaj<-ts(tecaj$tecaj,start=c(2000,1),frequency = 12)
dolasci<-read_excel("msi-turizam.xlsx",sheet="List1")
dolasci<-ts(dolasci$`dolasci, ukupno u 000`,start=c(2010,1),frequency = 12)
des_dolasci<-ma(dolasci,12,centre=T)
par(mfrow = c(2,2),oma=c(1,1,1,1),mar=c(2,2,2,2))
plot(IIP,xlab=NA,ylab=NA)
plot(BDP,xlab=NA,ylab=NA)
plot(tecaj,xlab=NA,ylab=NA)
plot(dolasci,xlab=NA,ylab=NA)
lines(des_dolasci,lty="dashed")
legend("topleft", legend=c("dolasci, ukupno u 000","desezonirano"),
col=c("black", "black"), lty=c(1,2))
View(m1)
View(m2)
View(m1)
library("FitARMA")
z7 <- ImpulseCoefficientsARMA(phi=0.2, theta=0,lag.max=10)
z8 <- ImpulseCoefficientsARMA(phi=0.95,theta=0,lag.max=10)
par(mfrow = c(1, 2),oma=c(0,0,0,0),mar=c(2,4,2,1))
plot(z7,type="l",ylab="0.2",xlab="pomak")
abline(h=0,lty="dashed")
plot(z8,type="l",ylab="0.95",xlab="pomak")
abline(h=0,lty="dashed")
View(nizovi)
par(mfrow = c(1,2),oma=c(1,0,0,1),mar=c(1,4,1,1))
bdp<-read.table("bdp_agregati.txt",header=T,sep="\t")
drzavna<-ts(bdp$drzava,start=c(1995,1),frequency = 4)
stopa<-diff(log(drzavna),4)
y2<-ts(nizovi$Y2,start=c(2003,9),frequency=12)
knitr::opts_chunk$set(echo = TRUE)
nestac<-read.table("nestac.txt",head=T,sep="\t")
nestac<-read.table("nestac.txt",head=T,sep="\t")
y2<-ts(nizovi$Y2,start=c(2003,9),frequency=12)
nestac<-read.table("nestac.txt",head=T,sep="\t")
y1<-ts(nestac$y1,start=c(2005,1),frequency = 12)
y2<-ts(nestac$y2,start=c(2005,1),frequency = 12)
y3<-ts(nestac$y3,start=c(2005,1),frequency = 12)
y2<-ts(nizovi$Y2,start=c(2003,9),frequency=12)
nestac<-read.table("nestac.txt",head=T,sep="\t")
y1<-ts(nestac$y1,start=c(2005,1),frequency = 12)
y2<-ts(nestac$y2,start=c(2005,1),frequency = 12)
y3<-ts(nestac$y3,start=c(2005,1),frequency = 12)
y2<-ts(nestac$Y2,start=c(2003,9),frequency=12)
nestac<-read.table("nestac.txt",head=T,sep="\t")
View(nestac)
View(nestac)
lines(ts(fitted(m1),start=c(1995,1),frequency = 4),lty="dashed")
bdp<-read.table("bdp.txt",header=T,sep="\t")
bdp<-ts(bdp$BDP,start=c(1995,1),frequency = 4)
#SLika 1.13.
par(mfrow = c(1,1),oma=c(1,0,0,1),mar=c(1,4,1,1))
plot(bdp,xlab="godine",ylab="BDP")
#Slika 1.14 i 1.15.
library(forecast)
bin<-seasonaldummy(bdp)
bin2<-c(rep(1,52),rep(0,102-52))
trend<-ts(1:102,start=c(1995,1),frequency = 4)
m1<-lm(bdp~bin)
m2<-lm(bdp~bin+I(bin*bin2))
m3<-lm(bdp~bin+trend+I(bin*bin2)+I(trend*bin2))
library(stargazer)
stargazer(list(m1,m2,m3),type="text")
#Slika 1.16
lines(ts(fitted(m1),start=c(1995,1),frequency = 4),lty="dashed")
lines(ts(fitted(m2),start=c(1995,1),frequency = 4),col="grey")
lines(ts(fitted(m3),start=c(1995,1),frequency = 4),col="black",type="b",lty=1)
legend("topleft", legend=c("BDP", "m1","m2","m3"),
col=c("black", "black","grey","black"), lty=c(1,2,1,3))
knitr::opts_chunk$set(echo = TRUE)
```{r Slika 1.12., warning=FALSE}
bdp<-read.table("bdp.txt",header=T,sep="\t")
bdp<-ts(bdp$BDP,start=c(1995,1),frequency = 4)
par(mfrow = c(1,1),oma=c(1,0,0,1),mar=c(1,4,1,1))
plot(bdp,xlab="godine",ylab="BDP")
```
vec3<-VECM(m2,lag=0,include="const",LRinclude="none",estim="ML")
vec3<-VECM(m2,lag=0,include="const",LRinclude="none",estim="ML")
knitr::opts_chunk$set(echo = TRUE)
vec3<-VECM(m2,lag=0,include="const",LRinclude="none",estim="ML")
